package hczc.longcai.com.hccrowdfunding.home.fourth_mine.activities;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

import hczc.longcai.com.hccrowdfunding.R;
import hczc.longcai.com.hccrowdfunding.activity.BaseActivity;
import hczc.longcai.com.hccrowdfunding.home.fourth_mine.adapters.InvestmentOrderAdapter;
import hczc.longcai.com.hccrowdfunding.home.fourth_mine.beans.InvestmentOrder;

public class InvestmentOrderActivity extends BaseActivity implements View.OnClickListener, AdapterView.OnItemClickListener {

    private List<InvestmentOrder> list;
    private ListView listView;
    private InvestmentOrderAdapter adapter;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_investment_order);

        initDatas();
        initViews();

    }

    private void initDatas() {
        list = new ArrayList<>();
        list.add(new InvestmentOrder());
        list.add(new InvestmentOrder());
        list.add(new InvestmentOrder());

    }

    private void initViews() {
        findViewById(R.id.head_back).setOnClickListener(this);
        ((TextView) findViewById(R.id.head_title)).setText("投资订单");

        listView = ((ListView) findViewById(R.id.mine_investment_order_listview));
        adapter = new InvestmentOrderAdapter(this,list);
        listView.setAdapter(adapter);
        listView.setOnItemClickListener(this);

    }

    @Override
    public void onClick(View v) {
        int id = v.getId();
        switch (id){
            case R.id.head_back:
                finish();
                break;
        }
    }

    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        startActivity(new Intent(InvestmentOrderActivity.this,OrdersDetailActivity.class));
    }
}
